From 0144a035fddb9025258eddcf458832110ebabca2 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 8 Aug 2006 09:59:47 +0100 Subject: [PATCH] [HVM][VMX] Move hvm interface init_hypercall_page initialization into vmx_setup_hvm_funcs. Signed-off-by: Xin Li --- xen/arch/x86/hvm/vmx/vmx.c | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 7f5439ddf7..a7079d8b41 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -671,6 +671,28 @@ static int check_vmx_controls(u32 ctrls, u32 msr) return 1; } +static void vmx_init_hypercall_page(struct domain *d, void *hypercall_page) +{ + char *p; + int i; + + memset(hypercall_page, 0, PAGE_SIZE); + + for ( i = 0; i < (PAGE_SIZE / 32); i++ ) + { + p = (char *)(hypercall_page + (i * 32)); + *(u8 *)(p + 0) = 0xb8; /* mov imm32, %eax */ + *(u32 *)(p + 1) = i; + *(u8 *)(p + 5) = 0x0f; /* vmcall */ + *(u8 *)(p + 6) = 0x01; + *(u8 *)(p + 7) = 0xc1; + *(u8 *)(p + 8) = 0xc3; /* ret */ + } + + /* Don't support HYPERVISOR_iret at the moment */ + *(u16 *)(hypercall_page + (__HYPERVISOR_iret * 32)) = 0x0b0f; /* ud2 */ +} + /* Setup HVM interfaces */ static void vmx_setup_hvm_funcs(void) { @@ -691,28 +713,8 @@ static void vmx_setup_hvm_funcs(void) hvm_funcs.get_guest_ctrl_reg = vmx_get_ctrl_reg; hvm_funcs.init_ap_context = vmx_init_ap_context; -} -static void vmx_init_hypercall_page(struct domain *d, void *hypercall_page) -{ - char *p; - int i; - - memset(hypercall_page, 0, PAGE_SIZE); - - for ( i = 0; i < (PAGE_SIZE / 32); i++ ) - { - p = (char *)(hypercall_page + (i * 32)); - *(u8 *)(p + 0) = 0xb8; /* mov imm32, %eax */ - *(u32 *)(p + 1) = i; - *(u8 *)(p + 5) = 0x0f; /* vmcall */ - *(u8 *)(p + 6) = 0x01; - *(u8 *)(p + 7) = 0xc1; - *(u8 *)(p + 8) = 0xc3; /* ret */ - } - - /* Don't support HYPERVISOR_iret at the moment */ - *(u16 *)(hypercall_page + (__HYPERVISOR_iret * 32)) = 0x0b0f; /* ud2 */ + hvm_funcs.init_hypercall_page = vmx_init_hypercall_page; } int start_vmx(void) @@ -781,8 +783,6 @@ int start_vmx(void) vmx_setup_hvm_funcs(); - hvm_funcs.init_hypercall_page = vmx_init_hypercall_page; - hvm_enabled = 1; return 1; -- 2.30.2